Return to start page
Core/Interface/Library Text Tag.j
1 library ALibraryCoreInterfaceTextTag
2
3 /// @author Tamino Dauth
4 /// We do not want to use player forces ftw!!!
5 function ShowTextTagForPlayer takes player user, texttag textTag, boolean show returns nothing
6 local player localPlayer = GetLocalPlayer()
7 if (user == localPlayer) then
8 call SetTextTagVisibility(textTag, show)
9 endif
10 set localPlayer = null
11 endfunction
12
13 /// @author Tamino Dauth
14 function ShowFadingTextTagForPlayer takes player user, string text, real size, real x, real y, integer red, integer green, integer blue, integer alpha, real velocity, real fadepoint, real lifespan returns nothing
15 local player localPlayer
16 local texttag textTag = CreateTextTag()
17 call SetTextTagText(textTag, text, size)
18 call SetTextTagPos(textTag, x, y, 0.0)
19 call SetTextTagColor(textTag, red, green, blue, alpha)
20 call SetTextTagVelocity(textTag, 0.0, velocity)
21 if (user == null) then
22 call SetTextTagVisibility(textTag, true)
23 else
24 call ShowTextTagForPlayer(user, textTag, true)
25 endif
26 call SetTextTagFadepoint(textTag, fadepoint)
27 call SetTextTagLifespan(textTag, lifespan)
28 call SetTextTagPermanent(textTag, false)
29 set textTag = null
30 endfunction
31
32 /// @author Tamino Dauth
33 function ShowGeneralFadingTextTagForPlayer takes player user, string text, real x, real y, integer red, integer green, integer blue, integer alpha returns nothing
34 call ShowFadingTextTagForPlayer(user, text, 0.025, x, y, red, green, blue, alpha, 0.03, 1.0, 2.0)
35 endfunction
36
37 // The following parameters have been token from the UI/Misc.txt file of the War3X.mpq archive.
38
39 /// @author Tamino Dauth
40 function ShowGoldTextTagForPlayer takes player user, real x, real y, integer gold returns nothing
41 call ShowFadingTextTagForPlayer(user, "+" + I2S(gold), 0.025, x, y, 255, 255, 220, 0, 0.03, 1.0, 2.0)
42 endfunction
43
44 /// @author Tamino Dauth
45 function ShowLumberTextTagForPlayer takes player user, real x, real y, integer lumber returns nothing
46 call ShowFadingTextTagForPlayer(user, "+" + I2S(lumber), 0.025, x, y, 255, 0, 200, 80, 0.03, 1.0, 2.0)
47 endfunction
48
49 /// @author Tamino Dauth
50 function ShowBountyTextTagForPlayer takes player user, real x, real y, integer bounty returns nothing
51 call ShowFadingTextTagForPlayer(user, "+" + I2S(bounty), 0.025, x, y, 255, 255, 220, 0, 0.03, 2.0, 3.0)
52 endfunction
53
54 /// @author Tamino Dauth
55 function ShowMissTextTagForPlayer takes player user, real x, real y returns nothing
56 call ShowFadingTextTagForPlayer(user, GetLocalizedString("MISS") + "!", 0.025, x, y, 255, 255, 0, 0, 0.03, 1.0, 3.0)
57 endfunction
58
59 /// @author Tamino Dauth
60 function ShowCriticalStrikeTextTagForPlayer takes player user, real x, real y, integer damage returns nothing
61 call ShowFadingTextTagForPlayer(user, I2S(damage) + "!", 0.025, x, y, 255, 255, 0, 0, 0.04, 2.0, 5.0)
62 endfunction
63
64 /// @author Tamino Dauth
65 function ShowManaBurnTextTagForPlayer takes player user, real x, real y, integer damage returns nothing
66 call ShowFadingTextTagForPlayer(user, "-" + I2S(damage), 0.025, x, y, 255, 82, 82, 255, 0.04, 2.0, 5.0)
67 endfunction
68
69 /// @author Tamino Dauth
70 /// @todo Look for bash.
71 function ShowBashTextTagForPlayer takes player user, real x, real y, integer damage returns nothing
72 call ShowFadingTextTagForPlayer(user, I2S(damage) + "!", 0.025, x, y, 255, 0, 0, 255, 0.04, 2.0, 5.0)
73 endfunction
74
75 /**
76 * @author Vexorian
77 * @author Tamino Dauth
78 */
79 function Bounty takes player whichPlayer, real x, real y, integer bounty returns nothing
80 local string effectPath = ""
81 local effect whichEffect
82 call SetPlayerState(whichPlayer, PLAYER_STATE_RESOURCE_GOLD, GetPlayerState(whichPlayer, PLAYER_STATE_RESOURCE_GOLD) + bounty)
83 if (GetLocalPlayer() == whichPlayer) then
84 set effectPath = "UI\\Feedback\\GoldCredit\\GoldCredit.mdl"
85 endif
86 set whichEffect = AddSpecialEffect(effectPath, x, y)
87 call DestroyEffect(whichEffect)
88 set whichEffect = null
89 call ShowBountyTextTagForPlayer(whichPlayer, x, y, bounty)
90 endfunction
91
92 endlibrary